<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title></title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link href="/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="/css/animate.css" rel="stylesheet">
    <link href="/css/style.css?v=4.1.0" rel="stylesheet">

</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">


    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>页面元素管理 <small>添加</small></h5>
                </div>
                <div class="ibox-content">
                    <form method="post" action="/admin/viewItems/doCreate" class="form-horizontal">
                        {{csrf_field()}}
                        <input type="hidden" name="info[permission_id]" value="{{ $permissionId }}"/>
                        <div class="form-group @if($errors->has('info.name')) has-error @endif">
                            <label class="col-sm-2 control-label">页面元素名称：</label>
                            <div class="col-sm-6">
                                <div class="row">
                                    <div class="col-md-8">
                                        <input type="text" name="info[name]" value=""
                                               placeholder="页面名称" class="form-control">
                                        <span class="help-block m-b-none">{{$errors->first('info.name')}}</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">描述：</label>
                            <div class="col-sm-6">
                                <div class="row">
                                    <div class="col-md-8">
                                        <input type="text" name="info[description]" value=""
                                               placeholder="描述" class="form-control">
                                        <span class="help-block m-b-none"></span>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary" id="btn-submit" type="button">保存内容</button>
                                <a href="javascript:void(0);" onclick="window.history.back()">
                                <button class="btn btn-white" type="button">取消</button>
                                </a>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 全局js -->
<script src="/js/jquery.min.js?v=2.1.4"></script>
<script src="/js/bootstrap.min.js?v=3.3.6"></script>

<!-- 自定义js -->
<script src="/js/content.js?v=1.0.0"></script>
<script>
    $(document).ready(function(){

        $("#btn-submit").click(function () {
            var doc_name = $("input[name='info[name]']");
            var ex_string= /^[A-Za-z]+$/;
            if(doc_name.val().length  == 0 ){
                doc_name.next().html("值不能为空");
                doc_name.parents('.form-group').addClass('has-error');
                return false;
            }
            if(!ex_string.test(doc_name.val())){
                doc_name.next().html("值只能是英文字符串");
                doc_name.parents('.form-group').addClass('has-error');
                return false;
            }
            doc_name.next().html("");
            doc_name.parents('.form-group').removeClass('has-error');

            var doc_dec = $("input[name='info[description]']");
            if(doc_dec.val().length == 0){
                doc_dec.next().html("值只能是英文字符串");
                doc_dec.parents('.form-group').addClass('has-error');
                return false;
            }
            doc_dec.next().html("");
            doc_dec.parents('.form-group').removeClass('has-error');

            $('form').submit();
        });


    });
</script>


</body>

</html>
